home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 August: Tool Chest / Dev.CD Aug 00 TC Disk 2.toast / pc / sample code / sound / speech recognition sample / speechcallbacks.c < prev    next >
Encoding:
C/C++ Source or Header  |  2000-06-23  |  2.1 KB  |  80 lines

  1. /*
  2.     File:        SpeechCallbacks.c
  3.  
  4.     Contains:    
  5.  
  6.     Written by:     
  7.  
  8.     Copyright:    Copyright © 1996-1999 by Apple Computer, Inc., All Rights Reserved.
  9.  
  10.                 You may incorporate this Apple sample source code into your program(s) without
  11.                 restriction. This Apple sample source code has been provided "AS IS" and the
  12.                 responsibility for its operation is yours. You are not permitted to redistribute
  13.                 this Apple sample source code as "Apple sample source code" after having made
  14.                 changes. If you're going to re-distribute the source, we require that you make
  15.                 it clear in the source that the code was descended from Apple sample source
  16.                 code, but that you've made changes.
  17.  
  18.     Change History (most recent first):
  19.                 8/2/1999    Karl Groethe    Updated for Metrowerks Codewarror Pro 2.1
  20.                 
  21.  
  22. */
  23. #ifndef __SPEACHCALLBACKS__
  24. #include "SpeechCallbacks.h"
  25. #endif
  26.  
  27. OSErr        SetSpeechDoneCallback    (const SpeechChannel theSpeechChan)
  28. {
  29.     OSErr        theErr        = noErr;
  30.  
  31.     theErr = SetSpeechInfo (theSpeechChan, soSpeechDoneCallBack, NewSpeechDoneProc (SpeechDoneCallback));
  32.     if (theErr != noErr) {
  33.         DebugStr ("\pSetSpeechInfo (SetSpeechDoneCallback) error");
  34.     }
  35.  
  36.     return theErr;
  37. }
  38.  
  39. OSErr        SetWordCallback            (const SpeechChannel theSpeechChan)
  40. {
  41.     OSErr        theErr        = noErr;
  42.  
  43.     theErr = SetSpeechInfo (theSpeechChan, soWordCallBack, NewSpeechWordProc (WordCallback));
  44.     if (theErr != noErr) {
  45.         DebugStr ("\pSetSpeechInfo (SetWordCallback) error");
  46.     }
  47.  
  48.     return theErr;
  49. }
  50.  
  51. pascal void SpeechDoneCallback        (const SpeechChannel theSpeechChan,
  52.                                     const long refCon)
  53. {
  54. #pragma unused (theSpeechChan)
  55.  
  56.     if (refCon == 'test') {
  57. //        DebugStr ("\pEntering MySpeechDoneCallback, all is good.");
  58.     }
  59.     else {
  60.         DebugStr ("\pEntering MySpeechDoneCallback, all is NOT good.");
  61.     }    
  62. }
  63.  
  64. pascal void WordCallback            (const SpeechChannel theSpeechChan,
  65.                                     const long refCon,
  66.                                     const long wordPos,
  67.                                     const short wordLen)
  68. {
  69. #pragma unused (theSpeechChan)
  70. #pragma unused (wordPos)
  71. #pragma unused (wordLen)
  72.  
  73.     if (refCon == 'test') {
  74. //        DebugStr ("\pEntering MyWordCallback, all is good.");
  75.     }
  76.     else {
  77.         DebugStr ("\pEntering MyWordCallback, all is NOT good.");
  78.     }    
  79. }
  80.